/*
 * Copyright (C) 2010 Fred Barrie
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.aergia.vinny.gui.util;

import java.awt.Component;

import javax.swing.JOptionPane;

/**
 * @author Fred
 * 
 */
public final class DialogUtil {

	/**
	 * Alert the user to an error.
	 * 
	 * @param parent
	 * @param message
	 * @param title
	 */
	public static void alert(final Component parent, final String message, final String title) {
		JOptionPane.showMessageDialog(parent, message, title, JOptionPane.ERROR_MESSAGE);
	}

	/**
	 * Ask the user a question.
	 * 
	 * @param parent
	 * @param question
	 * @param title
	 * @return
	 */
	public static boolean askQuestion(final Component parent, final String question, final String title) {
		return JOptionPane.showConfirmDialog(parent, question, title, JOptionPane.YES_NO_OPTION,
				JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION;
	}

	private DialogUtil() {
		// empty
	}

}
